package com.yixun.qfbao.hander;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.yixun.qfbao.api.service.CPFollowUPService;
import com.yixun.qfbao.apidto.GetCPFollowListReqDto;
import com.yixun.qfbao.apidto.GetCPFollowListResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.model.PartnerInfo;
import com.yixun.qfbao.util.exception.TServerException;
import com.yixun.qfbao.vo.GetCPFollowListReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * （28）	报备跟进列表
 * @author xiaojin.li
 *
 */
@Service("getCPFollowListHander")
public class GetCPFollowListHander extends CommonAbstractHander {
	private static Logger logger= LoggerFactory.getLogger(GetCPFollowListHander.class);
	
	@Autowired
	private CPFollowUPService cpFollowUPService;
	
	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		logger.info("GetCPFollowListHander->doBusiness-> reqDto:{}", JSON.toJSONString(reqDto));
		GetCPFollowListReqVo req = (GetCPFollowListReqVo)reqDto;
		GetCPFollowListReqDto reqDto1 = req.getParams();
		BaseResponseDTO<GetCPFollowListResDto> res = new BaseResponseDTO<GetCPFollowListResDto>();
		GetCPFollowListResDto resDto = new GetCPFollowListResDto();
		try {
			resDto = cpFollowUPService.getCPFollowList(reqDto1);
		}catch(TServerException e){
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg(e.getErrorMsg());
		} catch (Exception e) {
			logger.error("GetCPFollowListHander error: {}", e);
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg("系统异常");
		}
		res.setResData(resDto);
		res.setResult(resDto.getResult());
		return res;
	}
	
}
